Page 85 - 2629_Devagiri_C-5
P. 85

when    clicked

                             set  score   to  0


                             forever
                               if   key  right arrow  pressed?  then


                                change x by  10


                               if   key  left arrow  pressed?  then


                                change y by -10



                               if   key  up arrow   pressed?  then

                                change y by  10



                               if   key  down arrow  pressed?  then


                                change y by -10



                               if   touching  Star  ?  then

                                change score    by  1

                                go to x: -120  y: 110



                               if    score  = 10   then


                                say  You Win  for  2  seconds

                                stop  all




                 Use the arrow keys on your keyboard to move the sprite up, down, left or right.

                 Whenever the sprite touches the Star, your score increases. If your score reaches
                 10, you win the game!


                                   Suppose you have to code a dance party in Scratch where characters keep
                                   dancing in a loop until stopped, which block will you use for this and which
                                   songs would you play in the program?






                                                                                                Scratch Meets AI   83
   80   81   82   83   84   85   86   87   88   89   90